//
//  ViewControllerSignIn.m
//  02-UI
//
//  Created by Snow on 16/7/15.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "ViewControllerSignIn.h"
#import "ViewController.h"
@interface ViewControllerSignIn ()

@end

@implementation ViewControllerSignIn

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];//添加背景图片
    UIView *viewOfBlack = [[UIView alloc] initWithFrame:self.view.frame];
    viewOfBlack.backgroundColor = [UIColor blackColor];
    viewOfBlack.alpha = 0.7;
    [self.view addSubview:viewOfBlack];
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"welcome_2"]];
    [self.view addSubview:imageView];
    imageView.frame = self.view.frame;
    imageView.alpha = 0.7;
    imageView.userInteractionEnabled = YES;
    //添加图标(中心)
    UIImageView *imageOfFlag = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_lagou"]];
    imageOfFlag.frame = CGRectMake(150, 110, 90, 150);
    [imageView addSubview:imageOfFlag];
    //手机.验证码
    UIView *viewOfUserPassWord = [[UIView alloc] initWithFrame:CGRectMake(10, 300, 355, 81)];
    viewOfUserPassWord.backgroundColor = [UIColor blackColor];
    [imageView addSubview:viewOfUserPassWord];
    viewOfUserPassWord.alpha = 0.7;
    viewOfUserPassWord.layer.masksToBounds = YES;
    viewOfUserPassWord.layer.cornerRadius = 5;
    UITextField *textOfPhone = [[UITextField alloc] initWithFrame:CGRectMake(10, 300, 355, 40)];
    [imageView addSubview:textOfPhone];
    UIImageView *imageOfPhone = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ImageOfPhone"]];
    imageOfPhone.frame = CGRectMake(10, 300, 30, 30);
    textOfPhone.leftView = imageOfPhone;
    textOfPhone.leftViewMode = UITextFieldViewModeAlways;
    textOfPhone.placeholder = @"请输入手机号";
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    dict[NSForegroundColorAttributeName] = [UIColor lightGrayColor];
    NSAttributedString *attribute = [[NSAttributedString alloc] initWithString:textOfPhone.placeholder attributes:dict];
    [textOfPhone setAttributedPlaceholder:attribute];
    UIView *viewOfLine = [[UIView alloc] initWithFrame:CGRectMake(10, 340, 355, 1)];
    viewOfLine.backgroundColor = [UIColor whiteColor];
    [imageView addSubview:viewOfLine];
    viewOfLine.alpha = 0.3;
    UITextField *textOfTestword = [[UITextField alloc] initWithFrame:CGRectMake(10, 341, 255, 40)];
    [imageView addSubview:textOfTestword];
    UIImageView *image2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ImageOfTest"]];
    image2.frame = CGRectMake(10, 341, 30, 30);
    textOfTestword.leftView = image2;
    textOfTestword.leftViewMode = UITextFieldViewModeAlways;
    UIView *viewOfLineLong = [[UIView alloc]initWithFrame:CGRectMake(264, 348, 1, 25)];
    viewOfLineLong.backgroundColor = [UIColor lightGrayColor];
    [imageView addSubview:viewOfLineLong];
    textOfTestword.placeholder = @"请输入验证码";
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    dic[NSForegroundColorAttributeName] = [UIColor lightGrayColor];
    NSAttributedString *attribute1 = [[NSAttributedString alloc] initWithString:textOfTestword.placeholder attributes:dic];
    [textOfTestword setAttributedPlaceholder:attribute1];
    UIButton *buttonOfSendTestWord = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfSendTestWord.frame = CGRectMake(265, 341, 100, 40);
    [buttonOfSendTestWord setTitle:@"获取验证码" forState:UIControlStateNormal];
    [buttonOfSendTestWord setTitleColor:[UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1] forState:UIControlStateNormal];
    [imageView addSubview:buttonOfSendTestWord];
    buttonOfSendTestWord.titleLabel.font = [UIFont systemFontOfSize:17];
    [buttonOfSendTestWord addTarget:self action:@selector(handleGetTestWord:) forControlEvents:UIControlEventTouchUpInside];
    //注册代表
    UIImageView *imageOfContract = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ImageOfContract"]];
    imageOfContract.frame = CGRectMake(44, 395, 16, 16);
    [imageView addSubview:imageOfContract];
    
    UILabel *labelOfAgree = [[UILabel alloc] initWithFrame:CGRectMake(60, 390, 120, 30)];
    [imageView addSubview:labelOfAgree];
    labelOfAgree.text = @"注册代表你已同意";
    labelOfAgree.font = [UIFont systemFontOfSize:14];
    labelOfAgree.textColor = [UIColor lightGrayColor];
    UIButton *buttonOfContract = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfContract.frame = CGRectMake(180, 390, 90, 30);
    [buttonOfContract setTitle:@"拉勾用户协议" forState:UIControlStateNormal];
    [buttonOfContract setTitleColor:[UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1] forState:UIControlStateNormal];
    [imageView addSubview:buttonOfContract];
    //注册
    UIButton *buttonOfSignIn = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfSignIn.frame = CGRectMake(10, 460, 355, 40);
    buttonOfSignIn.backgroundColor = [UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1];
    [imageView addSubview:buttonOfSignIn];
    [buttonOfSignIn setTitle:@"注册" forState:UIControlStateNormal];
    [buttonOfSignIn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonOfSignIn addTarget:self action:@selector(handleSignIn:) forControlEvents:UIControlEventTouchUpInside];
    //返回登录
    UIView *viewOfGetBack = [[UIView alloc] initWithFrame:CGRectMake(10, 530, 350, 40)];
    viewOfGetBack.backgroundColor = [UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1];
    viewOfGetBack.alpha = 0.1;
    [imageView addSubview:viewOfGetBack];
    UIButton *buttonOfGetBack = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfGetBack.frame = CGRectMake(10, 530, 350, 40);
    [buttonOfGetBack setTitle:@"返回登录" forState:UIControlStateNormal];
    buttonOfGetBack.layer.masksToBounds = YES;
    buttonOfGetBack.layer.borderWidth = 1;
    buttonOfGetBack.layer.borderColor = [[UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1] CGColor];
    buttonOfGetBack.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    [buttonOfGetBack setTitleColor:[UIColor colorWithRed:0.2 green:0.8 blue:0.58 alpha:1] forState:UIControlStateNormal];
    [buttonOfGetBack addTarget:self action:@selector(handleGetBack:) forControlEvents:UIControlEventTouchUpInside];
    [imageView addSubview:buttonOfGetBack];
}
- (void)handleSignIn:(UIButton *)button
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)handleGetBack:(UIButton *)button
{
    ViewController *vc = [ViewController new];
    [self presentViewController:vc animated:YES completion:nil];
}
- (void)handleGetTestWord:(UIButton *)button
{
    NSLog(@"已经发送验证码至您的手机 请注意查收");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
